import Vue from 'vue'

import 'normalize.css/normalize.css' // A modern alternative to CSS resets

import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
import locale from 'element-ui/lib/locale/lang/en' // lang i18n

import '@/styles/index.scss' // global css

import App from './App'
import store from './store'
import router from './router'

import '@/icons' // icon
import '@/permission' // permission control

// 导入注册的插件
import Component from '@/components'
// 导入过滤器
import * as filters from '@/filters'
// 注册全局过滤器
Object.keys(filters).forEach(key => {
  // 注册过滤器
  Vue.filter(key, filters[key])
})

import i18n from '@/lang/index'
Vue.use(ElementUI, {
  i18n: (key, value) => i18n.t(key, value)
})
// set ElementUI lang to EN
// Vue.use(ElementUI, { locale })
// 如果想要中文版 element-ui，按如下方式声明
// Vue.use(ElementUI)


Vue.config.productionTip = false

// import { imgerror } from '@/directives'
import * as directives from '@/directives'
// directives 就是 {imgerror}

Object.keys(directives).forEach(key => {
  Vue.directive(key, directives[key])
  // 这里的el就是一个dom对象，是img标签
})


// 导入打印自定义指令
import Print from 'vue-print-nb'
Vue.use(Print)

Vue.use(Component)

// 导入全局混入mixin对象
import checkPermission from '@/mixin/checkPermission'
Vue.use(checkPermission)

import {fullScreens} from '@/directives/fullScreen'
Vue.use(fullScreens)





new Vue({
  el: '#app',
  router,
  store,
  i18n,
  render: h => h(App)
})
